package com.gscitysfy.cus.drain.modules.special.controller;

import com.gscitysfy.cus.drain.modules.special.service.DrainSpecialService;
import com.gscitysfy.cus.drain.modules.special.vo.DeviceTypeInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import com.gscitysfy.cloudfrmwk.assistant.domain.Result;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Tag(name = "小程序 -> 地图")
@AllArgsConstructor
@RestController
@RequestMapping("/special")
public class SpecialController {

    public static final String tempToken = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwaG9uZU51bWJlciI6IjE1OTU1MjEyNTE4IiwidXNlcl9uYW1lIjoic3lzdGVtIiwib3BlbmlkIjoiMSIsInNjb3BlIjpbImFsbCJdLCJuYW1lIjoi5bmz5Y-w566h55CG5ZGYIiwiYXZhdGFyIjpudWxsLCJleHAiOjE2NjYyNjk0OTIsInVzZXJOYW1lIjoic3lzdGVtIiwiYXV0aG9yaXRpZXMiOlsiT1BfMTUxMTE3MjQ5MCIsIk9QXzE5NzYxODI2MzkiLCJPUF83Mzg4MTkyMzkiLCJPUF8xOTAxMzcyNzU0IiwiT1BfMTg5MzEzMzQwNyIsIlJPTEVfQURNSU5JU1RSQVRPUiIsIk9QXzE0ODg1ODI5NDYiXSwianRpIjoiOWY1MGNkOGQtMjVjYi00NTIyLTkzMDgtOTU5MWEyMTQ1NDNkIiwiY2xpZW50X2lkIjoiYTRmNTljM2EtY2RkZS00MzkzLTk2MWMtZWYxYTE2NTUyM2ZmIn0.DZHfoERH8BPqEyBIobnRp1Ku32MSspgGIfgamdVshqE";

    @Resource
    DrainSpecialService drainSpecialService;

    @Operation(summary = "获取图层设备类型列表")
    @GetMapping("/getDeviceTypeList")
    public Result<List<DeviceTypeInfo>> getDeviceTypeList(){
        List<DeviceTypeInfo> deviceTypeList = drainSpecialService.getDeviceTypeList();
        return Result.success("操作成功",deviceTypeList);
    }

    @Operation(summary = "根据设备类型获取设备信息")
    @GetMapping("/getListByDeviceType")
    public Result<List<Map<String, Object>>> getListByDeviceType(@RequestHeader(required = false)String Authorization, @RequestParam String deviceType){
//        List<Map<String, Object>> stationList = drainSpecialService.getListByDeviceType(tempToken, deviceType);
        List<Map<String, Object>> stationList = drainSpecialService.getListByDeviceType(Authorization, deviceType);
        return Result.success("操作成功",stationList);
    }



    @Operation(summary = "获取泵站详情")
    @GetMapping("/getPumpDetail")
    public Result<Map<String, Object>> getPumpDetail(@RequestHeader(required = false)String Authorization, @RequestParam String id){
//        Map<String, Object> pumpDetail = drainSpecialService.getPumpDetail("Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwaG9uZU51bWJlciI6IjE1OTU1MjEyNTE4IiwidXNlcl9uYW1lIjoic3lzdGVtIiwib3BlbmlkIjoiMSIsInNjb3BlIjpbImFsbCJdLCJuYW1lIjoi5bmz5Y-w566h55CG5ZGYIiwiYXZhdGFyIjpudWxsLCJleHAiOjE2NjY4Mjk5MzgsInVzZXJOYW1lIjoic3lzdGVtIiwiYXV0aG9yaXRpZXMiOlsiT1BfMTUxMTE3MjQ5MCIsIk9QXzE5NzYxODI2MzkiLCJPUF83Mzg4MTkyMzkiLCJPUF8xOTAxMzcyNzU0IiwiT1BfMTg5MzEzMzQwNyIsIlJPTEVfQURNSU5JU1RSQVRPUiIsIk9QXzE0ODg1ODI5NDYiXSwianRpIjoiMWU0MmFmZWItNGYyMy00YjQwLWJmNTMtZWRmOTA1ZWI3NzFhIiwiY2xpZW50X2lkIjoiYTRmNTljM2EtY2RkZS00MzkzLTk2MWMtZWYxYTE2NTUyM2ZmIn0.lyQoSbPY-TXszh-kP_S4sZSYwlzWMeLIVPn_qMpyw-c", id);
        Map<String, Object> pumpDetail = drainSpecialService.getPumpDetail(Authorization, id);
        return Result.success("操作成功",pumpDetail);
    }


    @Operation(summary = "获取点位24小时监测曲线详情")
    @GetMapping("/queryHistoryDataLine")
    public Result<List<Map<String, Object>>> queryHistoryDataLine(@RequestHeader(required = false)String Authorization,
                                               @RequestParam String pointCode,@RequestParam String sensorCode,@RequestParam String tagCode,
                                               @RequestParam String startTime,@RequestParam String endTime){
//        List<Map<String, Object>> maps = drainSpecialService.queryHistoryDataLine(tempToken, pointCode, sensorCode, tagCode, startTime, endTime);
        List<Map<String, Object>> maps = drainSpecialService.queryHistoryDataLine(Authorization, pointCode, sensorCode, tagCode, startTime, endTime);
        return Result.success("操作成功",maps);
    }


/*@GetMapping("/getStationList")
    public Result<List<Map<String, Object>>> getStationList(@RequestHeader(required = false)String Authorization, @RequestParam String deviceType){
        List<Map<String, Object>> stationList = drainSpecialService.getStationList(Authorization, deviceType);
        return Result.success("操作成功",stationList);
    }*/


    @GetMapping("/selectStationAllAlarmList")
    public Result<List<Map<String, Object>>> selectStationAllAlarmList(@RequestHeader(required = false)String Authorization, @RequestParam String stationId){
        List<Map<String, Object>> maps = drainSpecialService.selectStationAllAlarmList(Authorization, stationId);
        return Result.success("操作成功",maps);
    }

    @GetMapping("/getStationInfoByStationId")
    public Result<Map<String, Object>> getStationInfoByStationId(@RequestHeader(required = false)String Authorization, @RequestParam String stationId){
        Map<String, Object> stationInfoByStationId = drainSpecialService.getStationInfoByStationId(Authorization, stationId);
        return Result.success("操作成功",stationInfoByStationId);
    }

    @GetMapping("/getPointByPointCode")
    public Result<List<Map<String, Object>>> getPointByPointCode(@RequestHeader(required = false)String Authorization, @RequestParam String coamPointCode){
        List<Map<String, Object>> pointByPointCode = drainSpecialService.getPointByPointCode(Authorization, coamPointCode);
        return Result.success("操作成功",pointByPointCode);
    }

    @GetMapping("/getPipelineByCoamSubjectCode")
    public Result<List<Map<String, Object>>> getPipelineByCoamSubjectCode(@RequestHeader(required = false)String Authorization, @RequestParam String coamSubjectCode){
        List<Map<String, Object>> pipelineByCoamSubjectCode = drainSpecialService.getPipelineByCoamSubjectCode(Authorization, coamSubjectCode);
        return Result.success("操作成功",pipelineByCoamSubjectCode);
    }

    @GetMapping("/getEquipByCoamEquipCode")
    public Result<List<Map<String, Object>>> getEquipByCoamEquipCode(@RequestHeader(required = false)String Authorization, @RequestParam String coamEquipCode){
        List<Map<String, Object>> equipByCoamEquipCode = drainSpecialService.getEquipByCoamEquipCode(Authorization, coamEquipCode);
        return Result.success("操作成功",equipByCoamEquipCode);
    }

}
